/*
 * Created: Author: Aléx Carvalho / Date: Feb 22, 2015
 * 
 * Changed: $Author: ac280593@gmail.com $ / $Date: 2015-06-12 03:38:01 +0000 (Fri, 12 Jun 2015) $
 */
package com.cpm.view.zk.field;

import com.cpm.aggregate.Attribute;
import com.cpm.view.CSSClass;
import org.zkoss.zk.ui.HtmlNativeComponent;

public class LabelField extends AbstractInputField<String> {

    private final HtmlNativeComponent label = new HtmlNativeComponent("span");
//    private final Label label = new Label();

    public LabelField() {
        label.setDynamicProperty("class", "z-label " );
    }

    public LabelField(String value) {
        this();
        setValue(value);
    }

    public LabelField(Attribute value) {
        this();
        setValue(value.getValue().toString());
    }

    @Override
    public final void setValue(String value) {
        label.setEpilogContent(value);
//        label.setValue(value);
    }

    @Override
    public String getValue() {
        return label.getEpilogContent();
//        return label.getValue();
    }

    public void setStyle(String style) {
//        label.setStyle(style);
        label.setDynamicProperty("style",style);
    }
    
    public void setCSSClass(CSSClass cssclass) {
        label.setDynamicProperty("class", cssclass.toString());
//        label.setSclass(cssclass.toString());
    }

    @Override
    public HtmlNativeComponent getElement() {
        return label;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }

    @Override
    public void setEnabled(boolean enable) {
    }
}
